/*
 * @Author: WangLi
 * @Date: 2021-06-07 09:48:22
 * @LastEditors: WangLi
 * @LastEditTime: 2024-05-07 14:58:25
 */
import { getUser } from "../../utils/storage";
import WPage from "../../common/WPage";

const app = getApp();
WPage({
  data: {},
  onLoad(options) {
    app.globalData.receiveId = options?.id ?? "";
    //小程序版本更新
    const updateManager = wx.getUpdateManager();
    // 请求完新版本信息的回调
    updateManager.onCheckForUpdate((res) => {
      if (!res.hasUpdate) {
        this.goPage();
      }
    });
    //新版本下载完成回调
    updateManager.onUpdateReady(() => {
      updateManager.applyUpdate();
    });
    // 新版本下载失败
    updateManager.onUpdateFailed(() => {
      this.goPage();
    });
  },
  async goPage() {
    try {
      wx.redirectTo({ url: "/pages/home/index" });
    } catch (error) {}
  },
});
